#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2005;
const ll INF = 0x3f3f3f3f3f3f3f3f;

int n, m;
int t[N], c[N];
ll dp[N];

void solve() {
  cin >> n;
  rep(i, 1, n) cin >> t[i] >> c[i];
  rep(i, 1, n) t[i]++;
  ll sum = accumulate(c + 1, c + n + 1, 0ll);
  memset(dp, 0x3f, sizeof(dp));
  dp[0] = 0;
  rep(i, 1, n) {
    per(j, n, 0) {
      int k = min(j + t[i], n);
      dp[k] = min(dp[k], dp[j] + c[i]);
    }
  }
  cout << dp[n] << endl;
  return;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  t = 1;
  while (t--) solve();
  return 0;
}